package com.spring5.learning;

import com.spring5.learning.processor.LoggerBeanPostProcessor;
import org.springframework.beans.factory.config.BeanPostProcessor;
import org.springframework.cache.CacheManager;
import org.springframework.cache.annotation.EnableCaching;
import org.springframework.cache.concurrent.ConcurrentMapCacheManager;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.PropertySource;

/**
 * @author xin
 * @version 1.0
 */
@Configuration
@ComponentScan
@EnableCaching
@PropertySource("classpath:app.properties")
public class AppConfig {

    @Bean
    public BeanPostProcessor loggerBeanPostProcessor() {
        return new LoggerBeanPostProcessor();
    }


    @Bean
    public CacheManager cacheManager() {
        return new ConcurrentMapCacheManager();
    }

}
